package com.sphd.restaurantsystem.adapters;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.restaurantsystem.R;
import com.sphd.restaurantsystem.info.LoginInfo;
import com.sphd.restaurantsystem.info.RestaurantInfo;
import com.sphd.restaurantsystem.info.SortInfo;

import java.util.List;

/**
 * Created by Hu on 2016/11/14.
 */

public class FoodTypeAdapter extends BaseQuickAdapter<SortInfo> {
    RestaurantInfo restaurantInfo;
    LoginInfo loginInfo;

    public FoodTypeAdapter(int layoutResId, List<SortInfo> data, RestaurantInfo restaurantInfo, LoginInfo loginInfo) {
        super(layoutResId, data);
        this.restaurantInfo = restaurantInfo;
        this.loginInfo = loginInfo;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, SortInfo sortInfo) {

        baseViewHolder
                .setText(R.id.food_type_title_textview, sortInfo.getSort())
                .setVisible(R.id.food_type_bianji_btn, restaurantInfo.getStaff_status() == 1 && loginInfo.getStaff_auth() == 2 ? false : true)
                .addOnClickListener(R.id.food_type_bianji_btn)
                .setText(R.id.food_type_num_textview, "有" + sortInfo.getDishes() + "个菜品");

    }
}
